'use strict';

const db = uniCloud.database();

exports.main = async (event, context) => {
  const { uuid } = event;

  try {
    // 查询用户信息
    const userInfo = await db.collection('users').where({
		uuid
	}).get();

    return {
      code: 200,
      message: '用户信息查询成功',
      data: userInfo.data[0]
    };
  } catch (err) {
    return {
      code: 500,
      message: '用户信息查询失败',
      error: err
    };
  }
};
